package cn.xiaye.blog.servlet;

import cn.xiaye.blog.bean.Article;
import cn.xiaye.blog.bean.Context;
import cn.xiaye.blog.dao.ArticleDao;
import cn.xiaye.blog.db.util.DateTimeUtil;

@SuppressWarnings("serial")
public class NewArticle extends FatherServlet {
	public String excute(Context context) {

		String text = context.getRequest().getParameter("text");
		String name = context.getRequest().getParameter("name");
		String sortId = context.getRequest().getParameter("sortId");
		Article art = new Article();
		art.setText(text);
		art.setName(name);
		art.setDate(DateTimeUtil.getCurrentDate());
		art.setTimes(0);
		art.setSortId(Integer.valueOf(sortId));
		ArticleDao articleDao = new ArticleDao();
		articleDao.insert(art);
	
		return "ShowMainPage";
	}

}
